import java.io.FileNotFoundException;


public class DijkstraTester {
	
	public static final int NODES_NUMBER = 100;
	public static final int SOURCE = 0;
	public static final int TARGET = 6;
	public static final int CAR_CAPACITY = 4;
	public static final String FILENAME = "/Users/marcotezzele/Documents/workspace/" + 
	                                      "autostops/branches/autostop_0.02/src/distance.txt";

	public static void main(String[] args) {

		Dijkstra dijkstraTest = new Dijkstra(NODES_NUMBER, CAR_CAPACITY);
		Map mapTest = new Map(NODES_NUMBER);
				
		dijkstraTest.init(SOURCE);
		try {
			mapTest.readFile(FILENAME, NODES_NUMBER);
			dijkstraTest.findPath(TARGET, mapTest, NODES_NUMBER);
			dijkstraTest.reconstructPath(TARGET);
			System.out.println("Minimum cost path from " + SOURCE + " to " +
					TARGET + " is: \n" + dijkstraTest.pathToString() + "\n" +
					"Number of addresses is: " + (dijkstraTest.pathLength(TARGET)+1) +
					"\n" + "Number of people is: " + dijkstraTest.passengerNumber(TARGET) + 
					"\n" + "The cost is: " + dijkstraTest.getDistance(TARGET));		
			System.out.println("If you went alone the cost is: " +
					mapTest.getDistance(SOURCE, TARGET) );
		} 
		catch (IllegalArgumentException exception) {
			System.out.println("Bad data: " + exception.getMessage());
		}
		catch (FileNotFoundException exception) {
			exception.printStackTrace();
		}
	}

}
